open(BUFF,"input_file")or die "no file found\n";
#$line=<BUFF>;
#./backup/s_0917401553.chr
#$sys = "vcf-concat A.vcf.gz B.vcf.gz C.vcf.gz | bgzip -c > ./final_vcf/ ";
@chr = ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','X','Y','M');
for($i=0;$i<@chr;$i++)
{                
	$sys = "";
	open(BUFF,"input_file")or die "no file found\n";
	open(WRBUFF,">sample_$chr[$i].csh") or die "no file found\n";
	while($line=<BUFF>)
	{
		chomp($line);
		if($line !~   m/^#/)
		{
			$line =~ s/^#//g;
			@arr = split("\t",$line);
			$names = "$arr[1].chr$chr[$i].snvs.raw.snvmix.vcf.gz";
			$file = "/data2/bsi/RandD/bora/Exome_2samples/backup/$arr[1].chr/".$names;
			#print "$file\n";
			if (-e $file )
			{
				#print "$file\n";
				print "dealing with $. $arr[1] $i $names[$i]\n";
				$sys = "$sys $file";
			}	
			else
			{
				die "no file found  $file\n";
			}
		}
	}			
	$sys = "/data2/bsi/RandD/bora/Exome_2samples/vcf-merge $sys | bgzip -c > /data2/bsi/RandD/bora/Exome_2samples/final_temp/40samples$chr[$i].vcf.gz";
	print WRBUFF "$sys\n";
	#system($sys);
	$sys = "tabix -p vcf -f /data2/bsi/RandD/bora/Exome_2samples/final_temp/40samples$chr[$i].vcf.gz";
	print WRBUFF "$sys\n";	
	#system("tabix -p vcf -f /data2/bsi/RandD/bora/Exome_2samples/final_vcf/$arr[1].vcf.gz");	
	$mail = 'prodduturi.naresh@mayo.edu';
	system("qsub -l h_vmem=3G -V -cwd -q 4-days -M $mail -m abe sample_$chr[$i].csh");
}
